<template>
	<view>
		<uv-navbar
			:leftIconColor="navstyle.txtColor"
			:titleStyle="titleStyle"
			:title="navstyle.title"
			:leftIcon="navstyle.leftIcon"
			:bgColor="navstyle.bgColor"
			:fixed="false"
			@leftClick="leftClick"
			:safeAreaInsetTop="false">
		</uv-navbar>
		<view class="news_title">
			{{articleInfo.articleTitle}}
		</view>
		<view class="article_meta">
			日期：{{articleInfo.date}}
		</view>
		<view class="article_content" v-html="articleInfo.articleContent">
			
		</view>
	</view>
</template>

<script>
	import {aListInfo} from '@/api/art.js';
	export default{
		data(){
			return{
				navstyle: {
					title: "新闻列表",
					txtColor: "#333333",
					bgColor: "#FFFFFF",
					leftIcon: "arrow-left",
				},
				titleStyle: {
					fontWeight: 700
				},
				articleId:'',
				articleInfo:'',
			}
		},
		onLoad(options) {
			this.articleId = options.articleId;
			aListInfo(this.articleId).then(response => {
				this.articleInfo = response.data;
			});
			
		},
		methods:{
			leftClick() {
				// 获取当前页面栈
				const pages = getCurrentPages();
				// 打印页面栈信息
				console.log(pages);
				uni.navigateBack({
					delta: 1
				})
			},
		}
	}
</script>

<style>
	.news_title{
	    display: flex;
	    flex-direction: column;
	    justify-content: center;
	    width: 100%;
	    height: auto;
	    line-height: 42px;
	    font-size: 22px;
	    border-bottom: 1px solid #000;
	    text-align: center;
	}
	.article_meta{
	    padding: 10px;
	    display: flex;
	    flex-direction: row;
	    justify-content: flex-start;
	    border-bottom: #f3f4f5 solid 1px;
	}
	.article_content{
	    line-height: 37px;
	    padding: 5%;
	    word-wrap: break-word;
	    width: 90%;
	}
</style>